package com.tengju.user.infrastructure.repository.article;

import com.tengju.user.domain.model.article.ArticleInfoRepository;
import com.tengju.user.infrastructure.persistence.mybatis.dataobject.ArticleManageDO;
import com.tengju.user.infrastructure.persistence.mybatis.mapper.dealer.generate.ArticleManageDOMapper;
import org.springframework.stereotype.Repository;

@Repository
public class ArticleInfoRepositoryImpl implements ArticleInfoRepository {

    private final ArticleManageDOMapper articleManageDOMapper;

    public ArticleInfoRepositoryImpl(ArticleManageDOMapper articleManageDOMapper) {
        this.articleManageDOMapper = articleManageDOMapper;
    }

    @Override
    public String getArticleInfoContent(Integer id) {
        ArticleManageDO articleManageDO = articleManageDOMapper.selectByPrimaryKey(id);
        return articleManageDO == null ? "" : articleManageDO.getContent();
    }
}
